#ifndef __VISUALHELPERMANAGER_H__
#define __VISUALHELPERMANAGER_H__

#include "D3DRenderer.h"

namespace Renderer
{
	//--------------------------------------------------------------------
	//--------------------------------------------------------------------
	//--------------------------------------------------------------------

	class VisualHelperManager : public Renderable
	{
	public:
		VisualHelperManager(D3DRenderer& _rRenderer);
		virtual ~VisualHelperManager();

		virtual void Render();
		virtual const Matrix& GetWorldTransform() const;

		void AddGrid(const string& _strName, const Matrix& _oPlane, const float& _fRepeatFactor);
		void RemoveGrid(const string& _strName);

		void AddOrbit(const string& _strName, const float& _fLength);
		void RemoveOrbit(const string& _strName);

	protected:
		struct GridInfo
		{
			GridInfo();

			bool Create(const float& _fRepeatFactor, D3DRenderer& _rRenderer);
			void Release();
			void Render(D3DRenderer& _rRenderer);

			Matrix	m_oPlane;
			float	m_fRepeatFactor;
			LPDIRECT3DVERTEXBUFFER9	m_pVertexBuffer;
		};
		typedef map<DataKey, GridInfo> GridInfoMap;

		struct OrbitInfo
		{
			OrbitInfo();

			bool Create(const float& _fLength, D3DRenderer& _rRenderer);
			void Release();
			void Render(D3DRenderer& _rRenderer);

			static const unsigned int c_PointCount = 500;

			LPDIRECT3DVERTEXBUFFER9	m_pVertexBuffer;
		};
		typedef map<DataKey, OrbitInfo> OrbitInfoMap;

	protected:
		GridInfoMap						m_mGrids;
		OrbitInfoMap					m_mOrbits;
		Matrix							m_oWorld;
		D3DRenderer&					m_rRenderer;
		LPDIRECT3DVERTEXDECLARATION9	m_pOrbitVertexDecl;
	};
}

#endif // __VISUALHELPERMANAGER_H__